<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>人员管理</title>
<script src="${ctx}/js/emailAutoComplete.js"></script>
<style>
/*邮箱提示框样式*/
		ul, li {
			list-style:none;
		}
		.inputElem {
			width:198px;
			height:22px;
			line-height:22px;
			border:1px solid #ccc;
		}
		.parentCls ul{ padding-left: 10px; padding-right: 10px; }
		.auto-tip li { width: 100%; height: 30px; line-height: 30px; font-size: 14px;}
		.auto-tip li.hoverBg {
			background:#ddd;
			cursor:pointer;
		}

		.hidden {
			display:none;
		}

</style>
<script type="text/javascript">
$(document).ready(function(){
	$("#name").focus();
	$("#inputForm").validate({
		rules: {
			username: {
				remote:"${ctx}/user/checkUserName.do?oldName=" + encodeURIComponent("${user.username}"),
			},
			name:{
				maxlength:25
			},
			email: {
				required: true,
				email: true,
				maxlength:100,
				remote:"${ctx}/user/checkEmail.do?oldEmail=" + encodeURIComponent("${user.email}")
			},
		    mobilePhone:{
				phone:true
			},
			dutyName:{
				maxlength:25
			},
			remark:{
				maxlength:100
			}
		},
		messages: {
			username: {remote: "登录名已存在"},
			confirmNewPdcode: {equalTo: "输入与上面相同的密码"},
			email: {
				required: "请输入Email地址",
				email: "请输入正确的email地址",
				remote:"该邮箱已经存在"
				  }
		},
		submitHandler:function(form){
			loading("更新个人信息中...");
			form.submit();
		},
		errorPlacement: function(error, element) {
			if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
				error.appendTo(element.parent().parent());
			} else {
				error.insertAfter(element);
			}
		}
	});
});
</script>
</head>
<body>
	<ul class="nav nav-tabs" style="margin:0 4px;">
		<li class="active"><a href="${ctx}/user/view.do?top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}"> <i
				class="icon icon-list"></i>&nbsp;<span>个人信息</span>
		</a></li>
		<li><a
			href="${ctx}/user/changePwd.do?top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}"> <i
				class="icon icon-edit"></i>&nbsp;<span>修改密码</span>
		</a></li>
	</ul><div class="div">
	<form id="inputForm" action="${ctx}/user/savePerson.do?top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}"
		method="post" class="form-horizontal autoHeight">
		<input type="hidden" name="token" value="${token}">
		<input type="hidden" name="id" value="${user.id}"/>
		<tags:message content="${msg}"/>
		<fieldset>
    			<legend>人员信息</legend>
				<div class="control-group">
					<label class=" control-label">姓名:</label>
					<div class="controls">
					  <input class=" required" id="name" name="name"
							type="text" value="${user.name}">
					</div>
				</div>
				<div class="control-group">
					<label class=" control-label">性别:</label>
					<div class="controls">
						<pt:code name="sex" category="1001" hasEmpty="false"  default="${user.sex}"></pt:code>
					</div>
				</div>
				<div class="control-group">
					<label class=" control-label">电话:</label>
					<div class="controls">
						<input class="" id="mobilePhone" name="mobilePhone"
							type="text" value="${user.mobilePhone}">
					</div>
				</div>
				<div class="control-group ">
					<label class=" control-label">邮箱:</label>
					<div class="controls parentCls">
						<input class=" inputElem" id="email" name="email"
							type="text" value="${user.email}" autocomplete="off">
					</div>
				</div>
				<div class="control-group">
					<label class=" control-label">岗位职责:</label>
					<div class="controls">
						<input class="" id="dutyName" name="dutyName"
							type="text" value="${user.dutyName}">
					</div>
				</div>
				<div class="control-group">
					<label class=" control-label">所属单位:</label>
					 <div class="controls">
					 	<input class="" id="dutyName" name="dutyName" disabled="disabled"
							type="text" value="${user.org.orgName}">
					</div>
				</div>
				<div class="control-group">
					<label class=" control-label">备注:</label>
					<div class="controls">
						<input class="" id="remark" name="remark"
							type="text" value="${user.remark}">
					</div>
				</div>
		</fieldset>
		<fieldset>
   			<legend>登录信息</legend>
   			<div class="control-group" style="line-height:25px;height:25px;">
	   			<label class=" control-label">登录名:</label>
				<div class="controls">
					<span class="help-inline">${user.username}</span>
				</div>
			</div>
			<div class="control-group" style="line-height:25px;height:25px;">
	   			<label class=" control-label">角色:</label>
				<div class="controls">
					<span class="help-inline">${user.roleDes}</span>
				</div>
			</div>
   	    </fieldset>
		<div class="form-actions">
				<input id="btnSubmit" class="btn btn-primary" type="submit"
					value="保 存" />
					&nbsp;
		</div>
	</form></div>
</body>
</html>